﻿using Powerless_View.Controllers.Actions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Powerless_View.Controllers
{
    public class ReportServerController : Controller
    {
        public ActionResult Index()
        {
            if(String.IsNullOrEmpty(Request.QueryString["rs:Command"]))
                return View();
            var command = Request.QueryString["rs:Command"];

            if (command == "GetReportAndModels")
                return new GetReportAndModelsActionResult(string.Format("http://{0}/Content/rdlx/Report.rdlx", Request.Url.Authority));
            else if (command == "RenderEdit")
            {
                if (!String.IsNullOrEmpty(Request.QueryString["rs:ProgressiveSessionId"]))
                    return new RenderEditActionResult(string.Format("http://{0}/Content/rdlx/RenderEdit.bin", Request.Url.Authority));
            }

            //if unknown request
            return View();
        }
    }
}
